<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>后台管理</title>
    <link rel="stylesheet" href="/static/style.css">
    <link rel="stylesheet" href="/static/layui/css/layui.css">
</head>
<body>

<!--导航栏开始-->
<div class="admin-header">
    <ul class="layui-nav">
        <li class="layui-nav-item admin-logo">
            <a href="">后台管理</a>
        </li>
        <li class="layui-nav-item">
            <a href="javascript:;"><i class="layui-icon layui-icon-set-fill"></i>&nbsp;设置</a>
            <dl class="layui-nav-child">
                <dd><a href="javascript:;">修改密码</a></dd>
                <dd><a href="/user/logout">退出登录</a></dd>
            </dl>
        </li>
    </ul>
</div>
<!--导航栏结束-->

<!--主内容开始-->
<div class="admin-content">

    <div class="admin-cards-row">
        <div class="layui-card">
            <div class="layui-card-header admin-card-header">用户管理</div>
            <div class="layui-card-body admin-card-body">
                <button id="user-list" class="layui-btn">用户列表</button>
                <button id="add-user" class="layui-btn">添加用户</button>
            </div>
        </div>
        <div class="layui-card">
            <div class="layui-card-header admin-card-header">数据导入</div>
            <div class="layui-card-body admin-card-body">
                <button id="upload-excel" class="layui-btn">导入数据</button>
                <button id="downloadExcel" class="layui-btn">下载表格</button>
            </div>
        </div>
    </div>

    <button class="layui-btn" id="add">添加投票事件</button>
    <table id="voteList" class="layui-table" lay-filter="vote-list"></table>
</div>
<!--主内容结束-->

<!--底部开始-->
<footer>
    <p>
        <span>地址：安徽省六安市裕安区月亮岛</span>
        <!--<span>当前IP地址：211.70.164.115</span>-->
        <!--<span>访问量：2420493</span>-->
    </p>
    <p>
        <span>皖西学院 Copyright 2019-2025 @ All Rights Reserved</span>
    </p>
    <p>
        <span>建议使用IE9.0或以上版本</span>
    </p>
</footer>
<!--底部结束-->

<script type="text/html" id="listToolBar">
    <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="download">
        <i class="layui-icon layui-icon-download-circle"></i>下载二维码
    </a>
    <a class="layui-btn layui-btn-warm layui-btn-xs" style="background: #5FB878;" lay-event="check">
        <i class="layui-icon layui-icon-set"></i>投票情况
    </a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">
        <i class="layui-icon layui-icon-delete"></i>删除
    </a>
    <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="update">
        <i class="layui-icon layui-icon-edit"></i>修改
    </a>
</script>
<script type="text/html" id="voteStatus">
    <a class="layui-btn-xs" lay-event="switch">
        {{# if(d.isSelfVoted == true || d.isSelfVoted == 1){ }}
        <input type="checkbox" name="isSelfVoted" lay-skin="switch" lay-text="允许|禁止" checked>
        {{# } else { }}
        <input type="checkbox" name="isSelfVoted" lay-skin="switch" lay-text="允许|禁止">
        {{# } }}
    </a>
</script>
<script src="/static/layui/layui.js"></script>
<script>
    layui.config({
        base: '/static/lib/'
    }).extend({
        voteList: 'voteList'
    }).use(['voteList', 'element', 'jquery', 'layer', 'laytpl', 'form', 'upload'], function () {
        var $ = layui.$
            , layer = layui.layer
            , form = layui.form
            , element = layui.element
            , upload = layui.upload;

        $('#user-list').click(function () {
            layer.open({
                type: 2,
                title: '用户列表',
                shadeClose: true,
                shade: 0.8,
                area: ['95%', '95%'],
                content: '/user/list' //iframe的url
            })
        });

        //下载模板
        $('#downloadExcel').click(function () {
            window.open('/excel/download');
        });

        $('#add-user').click(function () {
            layer.open({
                type: 2,
                title: '添加用户',
                shadeClose: true,
                shade: 0.8,
                area: ['70%', '70%'],
                content: '/user/add' //iframe的url
            })
        });

        //执行实例
        var uploadInst = upload.render({
            elem: '#upload-excel' //绑定元素
            , url: '/excel/upload' //上传接口
            ,accept: 'file'
            ,exts: 'xls|xlsx'
            , done: function (res) {
                //上传完毕回调
                if (res.status == 200)
                    layer.msg(res.msg);
                else
                    layer.msg(res.msg, {icon: 2});
            }
            , error: function () {
                //请求异常回调
                layer.msg('请求异常', {icon: 2});
            }
        });
    });
</script>
</body>
</html>